﻿<?php
session_start();
require_once("conn.php");
$visableart= $_POST['visableart'];
$dingart= $_POST['dingart'];
$delart= $_POST['delart'];

if($delart=true){
   $i=0;
   while(list($name,$value)=each($_POST)){ 
    
   
   $result2=mysql_query("select * from artcontent where Art_id=".$name."'");
$row=mysql_fetch_array($result2);
$class=$row['cs_id'];
   $result3=mysql_query("UPDATE  artclass SET artnum=artnum-1 WHERE cs_id='$class'");
   $result=mysql_query("delete from artcontent where Art_id='".$name."'");  
   if(is_numeric($name)){
   $i++; }}
   echo "<script>alert('警告:您已经删除.".$i.".条记录!'); window.location.href='artlist.php';</script>";
}else{
	echo "<script>alert('删除失败!'); window.location.href='artlist.php';</script>";}

if($dingart=true){
   $i=0;
   while(list($name,$value)=each($_POST)){ 
   $result=mysql_query("PDATE  artcontent SET ding='1' where Art_id='".$name."'");  
   if(is_numeric($name)){
   $i++; }}
   echo "<script>alert('警告:您已经删除.".$i.".条记录!'); window.location.href='artlist.php';</script>";
}else{
	echo "<script>alert('删除失败!'); window.location.href='artlist.php';</script>";}
?>